package domain;
// Generated 11-jul-2009 12:00:40 by Hibernate Tools 3.2.1.GA


import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Contract generated by hbm2java
 */
@Entity
@Table(name="contract"
    ,catalog="domeco"
)
public class Contract  implements java.io.Serializable {


     private Integer idContract;
     private Bankaccount bankaccount;
     private Date dateContract;
     private Boolean active;
     private String nameContract;
     private Set<Consumption> consumptions = new HashSet<Consumption>(0);
     private Set<Insurancecontract> insurancecontracts = new HashSet<Insurancecontract>(0);
     private Set<Mortgagecontract> mortgagecontracts = null;
     private Set<Electricitycontract> electricitycontracts = new HashSet<Electricitycontract>(0);
     private Set<Watercontract> watercontracts = new HashSet<Watercontract>(0);
     private Set<Mobilecontract> mobilecontracts = new HashSet<Mobilecontract>(0);

    public Contract() {
    }

	
    public Contract(Bankaccount bankaccount, String nameContract) {
        this.bankaccount = bankaccount;
        this.nameContract = nameContract;
    }
    public Contract(Bankaccount bankaccount, Date dateContract, Boolean active, String nameContract) {
       this.bankaccount = bankaccount;
       this.dateContract = dateContract;
       this.active = active;
       this.nameContract = nameContract;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="idContract", unique=true, nullable=false)
    public Integer getIdContract() {
        return this.idContract;
    }
    
    public void setIdContract(Integer idContract) {
        this.idContract = idContract;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="bankFK", nullable=false)
    public Bankaccount getBankaccount() {
        return this.bankaccount;
    }
    
    public void setBankaccount(Bankaccount bankaccount) {
        this.bankaccount = bankaccount;
    }
    @Temporal(TemporalType.DATE)
    @Column(name="dateContract", length=10)
    public Date getDateContract() {
        return this.dateContract;
    }
    
    public void setDateContract(Date dateContract) {
        this.dateContract = dateContract;
    }
    
    @Column(name="active")
    public Boolean getActive() {
        return this.active;
    }
    
    public void setActive(Boolean active) {
        this.active = active;
    }
    
    @Column(name="nameContract", nullable=false, length=45)
    public String getNameContract() {
        return this.nameContract;
    }
    
    public void setNameContract(String nameContract) {
        this.nameContract = nameContract;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="contract")
    public Set<Consumption> getConsumptions() {
        return this.consumptions;
    }
    
    public void setConsumptions(Set<Consumption> consumptions) {
        this.consumptions = consumptions;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="contract")
    public Set<Insurancecontract> getInsurancecontracts() {
        return this.insurancecontracts;
    }
    
    public void setInsurancecontracts(Set<Insurancecontract> insurancecontracts) {
        this.insurancecontracts = insurancecontracts;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="contract")
    public Set<Mortgagecontract> getMortgagecontracts() {
        return this.mortgagecontracts;
    }
    
    public void setMortgagecontracts(Set<Mortgagecontract> mortgagecontracts) {
        this.mortgagecontracts = mortgagecontracts;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="contract")
    public Set<Electricitycontract> getElectricitycontracts() {
        return this.electricitycontracts;
    }
    
    public void setElectricitycontracts(Set<Electricitycontract> electricitycontracts) {
        this.electricitycontracts = electricitycontracts;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="contract")
    public Set<Watercontract> getWatercontracts() {
        return this.watercontracts;
    }
    
    public void setWatercontracts(Set<Watercontract> watercontracts) {
        this.watercontracts = watercontracts;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="contract")
    public Set<Mobilecontract> getMobilecontracts() {
        return this.mobilecontracts;
    }
    
    public void setMobilecontracts(Set<Mobilecontract> mobilecontracts) {
        this.mobilecontracts = mobilecontracts;
    }




}


